from common.PhoneDriver import PhoneDriver
from vo.AylaHome import AylaHome
from selenium.webdriver.support import expected_conditions as EC

class AylaHomeAction(PhoneDriver,AylaHome):

    def clickOn(self, ele,waitTime=0):
        try:

            if waitTime!=0:
                self.info('等待{0}秒---出现检索内容---点击：{0}'.format(waitTime,*ele))
                self.wait(waitTime).until(EC.presence_of_element_located(*ele)).click()
            else:
                self.info('通过：{0}点击'.format(ele))
                self.driver.find_element(*ele).click()
        except:
            return False
        else:
            return True
